<?php

namespace App\Admin\Renderable;

use App\Admin\Repositories\Shop\ShopUser;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class ShopUserRenderable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new ShopUser(), function (Grid $grid) {

            $id = $this -> id;

            $grid->column('id');

            $grid->column('sn','编号');

            $grid->column('nickname','昵称');

            $grid->column('mobile','电话');

            $grid->column('create_time','创建时间');

            $grid->quickSearch(['sn']);

            $grid->paginate(5);

            $grid->disableRowSelector(false);

            $grid->rowSelector()->disable(function ($row) use ($id) {
                if($row->id == $id) {
                    return true;
                }
                return false;
            });

            $grid->disableActions();
        });
    }
}
